﻿@model DHQGHN.PM2.Models.Online.HouseHoldDetailPartialViewModel
@*<link href="~/Content/bootstrap.css" rel="stylesheet" />*@
<script>
     @functions{
         public string GetAntiForgeryToken()
         {
             string cookieToken, formToken;
             AntiForgery.GetTokens(null, out cookieToken, out formToken);
             return cookieToken + "," + formToken;
         }
     }
    $('#btnResetLoginCode').click(function () {
        var houseId = $('#HOUSEHOLD_ID').val();

        var dataSend = {
            'houseHoldId': houseId
        };
        var box = bootbox.dialog({
            title: "Thông báo",
            message: 'Bạn có muốn Reset mã Pin Timeout cho hộ này không?',
            onEscape: function () {
                box.modal('hide');
            },
            buttons: {
                success: {
                    label: "<i class='fa fa-save'></i> Đồng ý",
                    className: "btn btn-sm btn-primary", 
                    callback: function () {
                        var jqXHR = $.ajax({
                            url: '@Url.Action( "ResetCodeLoginHouseHold2","Online")',
                            dataType: 'html',
                            method: 'post',
                            headers: {
                                'VerificationToken': '@GetAntiForgeryToken()'
                            },
                            data: dataSend,
                            success: function (data, textStatus, jqXHR) {
                                $('#container').html(data);
                            },
                            error: function (jqXHR, textStatus, errorThrown) {
                                alert('Có lỗi xảy ra trong quá trình đăng nhập: ' + errorThrown);
                            }
                        });
                    }
                },
                danger: {
                    label: "<i class='fa fa-reply'></i> Bỏ qua",
                    className: "btn btn-sm btn-default",
                    callback: function () {
                    }
                }
            }
        });
    });
</script>
@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(m => m.HOUSEHOLD_ID)
    <div class="form-group">
        @Html.Label("Thông tin hộ cần Reset mã Pin Timeout", new { @class = "control-label" })
    </div>

    <div class="form-horizontal">
        <div class="form-group form-group-sm">
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.HOUSEHOLD_NAME, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.HOUSEHOLD_NAME, new { @class = "form-control col-sm-3", @readOnly = true })
            </div>
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.AREA_NAME, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.AREA_NAME, new { @class = "form-control", @readOnly = true })
            </div>
        </div>
        <div class="form-group form-group-sm">
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.NUM_OF_HH_MEMBER, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.NUM_OF_HH_MEMBER, new { @class = "form-control", @readOnly = true })
            </div>
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.ADDRESS_NAME, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.ADDRESS_NAME, new { @class = "form-control", @readOnly = true })
            </div>
        </div>
        <div class="form-group form-group-sm">
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.HH_HEAD_EMAIL, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.HH_HEAD_EMAIL, new { @class = "form-control", @readOnly = true })
            </div>
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.HH_HEAD_MOBILE, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.HH_HEAD_MOBILE, new { @class = "form-control", @readOnly = true })
            </div>
        </div>
        <div class="form-group form-group-sm">
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.ONLINE_SURVEY_STATUS, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.ONLINE_SURVEY_STATUS, new { @class = "form-control", @readOnly = true })
            </div>
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.HOUSEHOLD_NUMBER, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.HOUSEHOLD_NUMBER, new { @class = "form-control", @readOnly = true })
            </div>
        </div>
        <div class="form-group form-group-sm">
            <div class="col-sm-2 text-right">
                @Html.LabelFor(m => m.LOGINFIRST, new { @class = "control-label" })
            </div>
            <div class="col-sm-3">
                @Html.TextBoxFor(m => m.LOGINFIRST, new { @class = "form-control", @readOnly = true })
            </div>


        </div>
    </div>

    <div class="form-group form-group-sm">
        <center>
            <button type="button" id="btnResetLoginCode" class="btn btn-sm btn-success">
                <span class="glyphicon glyphicon-repeat"></span>
                Reset mã Pin Timeout
            </button>
            @Html.ActionLink("Quay lại", "ResetCodeLogin", "Online", new { @class = "btn btn-success btn-sm" })

        </center>
    </div>


}

